# !python3      # 使用工具:PyCharm
# 用户登录名:yyds_l
# 项目名称: python爬虫     文件名称:find及find_all查找
# 系统日期:2022/3/14      系统时间:19:27
# 2022/03/14 19:27

"""ok"""
from bs4 import BeautifulSoup
import urllib.request


def print_hi():
    url = "http://59468.cn/"
    html = urllib.request.urlopen(url=url)
    data = html.read()
    html = data.decode("utf-8")
    # print(html)
    soup = BeautifulSoup(html, "html.parser")       # 解释器 ：html.parser
    title = soup.find("title")
    print(type(title), title, title.text)
    a_list = soup.find_all(name="a", attrs={"class": "team-wrapper"})
    for a_url in a_list:
        url = a_url["href"]
        a_class = a_url["class"]
        print(a_class)
        text = a_url.text
        # print(url, text)


if __name__ == '__main__':
    print_hi()
